3 Equivalent Water Thickness/Canopy Water Content from Imaging Spectroscopy Data
Summary
In this notebook we will explore how Equivalent Water Thickness (EWT) or Canopy Water Content (CWC) can be calculated from the Earth Surface Mineral Dust Source Investigation (EMIT) L2A Reflectance Product, then we will apply this knowledge to calculate CWC over the Jack and Laura Dangermond Preserve located near Santa Barbara, CA.
Background
Equivalent Water Thickness (EWT) is the predicted thickness or absorption path length in centimeters (cm) of water that would be required to yield an observed spectra. In the context of vegetation, this is equivalent to canopy water content (CWC) in g/cm^2 because a cm^3 of water has a mass of 1g.
CWC can be derived from surface reflectance spectra because they provide information about the composition of the target, including water content. Reflectance is the fraction of incoming solar radiation reflected by Earth’s surface. Different materials reflect varying proportions of radiation based upon their chemical composition and physical properties, giving materials their own unique spectral signature or fingerprint. In particular, liquid water causes characteristic absorption features to appear in the near-infrared wavelengths of the solar spectrum, which enables an estimation of its content.
CWC correlates with vegetation type and health, as well as wildfire risk. The methods used here to calculate CWC are based on the ISOFIT python package. The Beer-Lambert physical model used to calculate CWC is described in Green et al. (2006) and Bohn et al. (2020). It uses wavelength-dependent absorption coefficients of liquid water to determine the absorption path length as a function of absorption feature depth. Of note, this model does not account for multiple scattering effects within the canopy and may result in oversestimation of CWC (Bohn et al., 2020).
The Jack and Laura Dangermond Preserve and its surrounding lands are one one of the last “wild coastal” regions in Southern California. The preserve is over 24,000 acres and consists of several ecosystem types and is home to over 600 plant species and over 200 wildlife species.
Shrestha, Rupesh. 2023. Equivalent water thickness/canopy water content from hyperspectral data. Jupyter Notebook. Oak Ridge National Laboratory Distributed Active Archive Center. https://github.com/rupesh2/ewt_cwc/tree/main
Bohn, N., L. Guanter, T. Kuester, R. Preusker, and K. Segl. 2020. Coupled retrieval of the three phases of water from spaceborne imaging spectroscopy measurements. Remote Sensing of Environment 242:111708. https://doi.org/10.1016/j.rse.2020.111708
Green, R.O., T.H. Painter, D.A. Roberts, and J. Dozier. 2006. Measuring the expressed abundance of the three phases of water with an imaging spectrometer over melting snow. Water Resources Research 42:W10402. https://doi.org/10.1029/2005WR004509
Thompson, D.R., V. Natraj, R.O. Green, M.C. Helmlinger, B.-C. Gao, and M.L. Eastwood. 2018. Optimal estimation for imaging spectrometer atmospheric correction. Remote Sensing of Environment 216:355–373. https://doi.org/10.1016/j.rse.2018.07.003
Requirements - NASA Earthdata Account
- No Python setup requirements if connected to the workshop cloud instance!
- Local Only - Set up Python Environment. See setup_instructions.md in the /setup/ folder
- Local Only - Downloaded necessary files. This is done at the end of the 01_Finding_Concurrent_Data notebook.
Learning Objectives
- Calculate CWC of a single pixel
- Calculate CWC of an ROI
Tutorial Outline
3.1 Setup
3.2 Opening EMIT Data
3.3 Extracting Reflectance of a Pixel
3.4 Calculating CWC
3.4.1 Single Point
3.4.2 DataFrame of Points
3.5 Applying Inversion in Parallel Across an ROI
# Install ray on 2i2c!pip install "ray[default]"
Requirement already satisfied: ray[default] in /srv/conda/envs/notebook/lib/python3.10/site-packages (2.8.1)
Requirement already satisfied: click>=7.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (8.1.7)
Requirement already satisfied: filelock in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (3.12.4)
Requirement already satisfied: jsonschema in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (4.19.1)
Requirement already satisfied: msgpack<2.0.0,>=1.0.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (1.0.5)
Requirement already satisfied: packaging in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (23.1)
Requirement already satisfied: protobuf!=3.19.5,>=3.15.3 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (4.25.1)
Requirement already satisfied: pyyaml in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (6.0.1)
Requirement already satisfied: aiosignal in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (1.3.1)
Requirement already satisfied: frozenlist in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (1.4.0)
Requirement already satisfied: requests in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (2.31.0)
Requirement already satisfied: numpy>=1.19.3 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (1.24.4)
Requirement already satisfied: aiohttp>=3.7 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (3.8.5)
Requirement already satisfied: aiohttp-cors in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (0.7.0)
Requirement already satisfied: colorful in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (0.5.5)
Requirement already satisfied: py-spy>=0.2.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (0.3.14)
Requirement already satisfied: gpustat>=1.0.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (1.1.1)
Requirement already satisfied: opencensus in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (0.11.3)
Requirement already satisfied: pydantic<2 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (1.10.13)
Requirement already satisfied: prometheus-client>=0.7.1 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (0.17.1)
Requirement already satisfied: smart-open in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (6.4.0)
Requirement already satisfied: virtualenv<20.21.1,>=20.0.24 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (20.21.0)
Requirement already satisfied: grpcio>=1.42.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from ray[default]) (1.59.3)
Requirement already satisfied: attrs>=17.3.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from aiohttp>=3.7->ray[default]) (23.1.0)
Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from aiohttp>=3.7->ray[default]) (3.2.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from aiohttp>=3.7->ray[default]) (6.0.4)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from aiohttp>=3.7->ray[default]) (4.0.3)
Requirement already satisfied: yarl<2.0,>=1.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from aiohttp>=3.7->ray[default]) (1.9.2)
Requirement already satisfied: nvidia-ml-py>=11.450.129 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from gpustat>=1.0.0->ray[default]) (12.535.133)
Requirement already satisfied: psutil>=5.6.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from gpustat>=1.0.0->ray[default]) (5.9.5)
Requirement already satisfied: blessed>=1.17.1 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from gpustat>=1.0.0->ray[default]) (1.20.0)
Requirement already satisfied: typing-extensions>=4.2.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from pydantic<2->ray[default]) (4.8.0)
Requirement already satisfied: distlib<1,>=0.3.6 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from virtualenv<20.21.1,>=20.0.24->ray[default]) (0.3.7)
Requirement already satisfied: platformdirs<4,>=2.4 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from virtualenv<20.21.1,>=20.0.24->ray[default]) (3.10.0)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from jsonschema->ray[default]) (2023.7.1)
Requirement already satisfied: referencing>=0.28.4 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from jsonschema->ray[default]) (0.30.2)
Requirement already satisfied: rpds-py>=0.7.1 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from jsonschema->ray[default]) (0.10.3)
Requirement already satisfied: opencensus-context>=0.1.3 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from opencensus->ray[default]) (0.1.3)
Requirement already satisfied: google-api-core<3.0.0,>=1.0.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from opencensus->ray[default]) (2.14.0)
Requirement already satisfied: idna<4,>=2.5 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from requests->ray[default]) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from requests->ray[default]) (1.26.15)
Requirement already satisfied: certifi>=2017.4.17 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from requests->ray[default]) (2023.7.22)
Requirement already satisfied: wcwidth>=0.1.4 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from blessed>=1.17.1->gpustat>=1.0.0->ray[default]) (0.2.6)
Requirement already satisfied: six>=1.9.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from blessed>=1.17.1->gpustat>=1.0.0->ray[default]) (1.16.0)
Requirement already satisfied: googleapis-common-protos<2.0.dev0,>=1.56.2 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from google-api-core<3.0.0,>=1.0.0->opencensus->ray[default]) (1.61.0)
Requirement already satisfied: google-auth<3.0.dev0,>=2.14.1 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from google-api-core<3.0.0,>=1.0.0->opencensus->ray[default]) (2.25.1)
Requirement already satisfied: cachetools<6.0,>=2.0.0 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from google-auth<3.0.dev0,>=2.14.1->google-api-core<3.0.0,>=1.0.0->opencensus->ray[default]) (5.3.2)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from google-auth<3.0.dev0,>=2.14.1->google-api-core<3.0.0,>=1.0.0->opencensus->ray[default]) (0.3.0)
Requirement already satisfied: rsa<5,>=3.1.4 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from google-auth<3.0.dev0,>=2.14.1->google-api-core<3.0.0,>=1.0.0->opencensus->ray[default]) (4.9)
Requirement already satisfied: pyasn1<0.6.0,>=0.4.6 in /srv/conda/envs/notebook/lib/python3.10/site-packages (from pyasn1-modules>=0.2.1->google-auth<3.0.dev0,>=2.14.1->google-api-core<3.0.0,>=1.0.0->opencensus->ray[default]) (0.5.1)
3.1 Setup
Import the required Python libraries.
# Import Packagesimport osimport globimport earthaccessimport mathimport numpy as npimport xarray as xrfrom osgeo import gdalimport rasterio as rioimport rioxarray as rxrfrom matplotlib import pyplot as pltimport hvplot.xarrayimport hvplot.pandasimport holoviews as hvimport pandas as pdimport geopandas as gpimport sysfrom modules.emit_tools import emit_xarray, ortho_xrfrom modules.ewt_calc import calc_ewtfrom scipy.optimize import least_squares
3.2 Open an EMIT File
EMIT L2A Reflectance Data are distributed in a non-orthocorrected spatially raw NetCDF4 (.nc) format consisting of the data and its associated metadata. To work with this data, we will use the emit_xarray function from the emit_tools.py module included in the repository.
Set a filepath for an EMIT L2A reflectance file and open using the emit_xarray function.
Similarly to what we did in the previous notebook, we can plot a single band to get an idea of where our scene is. This is the same scene we processed earlier.